package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUserEmailMapper;
import com.ruoyi.common.core.domain.entity.SysUserEmail;
import com.ruoyi.system.service.ISysUserEmailService;

/**
 * 用户邮箱绑定Service业务层处理
 * 
 * @author 许建国
 * @date 2023-10-24
 */
@Service
public class SysUserEmailServiceImpl implements ISysUserEmailService 
{
    @Autowired
    private SysUserEmailMapper sysUserEmailMapper;

    /**
     * 查询用户邮箱绑定
     * 
     * @param id 用户邮箱绑定主键
     * @return 用户邮箱绑定
     */
    @Override
    public SysUserEmail selectSysUserEmailById(Long id)
    {
        return sysUserEmailMapper.selectSysUserEmailById(id);
    }

    /**
     * 查询用户邮箱绑定列表
     * 
     * @param sysUserEmail 用户邮箱绑定
     * @return 用户邮箱绑定
     */
    @Override
    public List<SysUserEmail> selectSysUserEmailList(SysUserEmail sysUserEmail)
    {
        return sysUserEmailMapper.selectSysUserEmailList(sysUserEmail);
    }

    /**
     * 新增用户邮箱绑定
     * 
     * @param sysUserEmail 用户邮箱绑定
     * @return 结果
     */
    @Override
    public int insertSysUserEmail(SysUserEmail sysUserEmail)
    {
        sysUserEmail.setCreateTime(DateUtils.getNowDate());
        return sysUserEmailMapper.insertSysUserEmail(sysUserEmail);
    }

    /**
     * 修改用户邮箱绑定
     * 
     * @param sysUserEmail 用户邮箱绑定
     * @return 结果
     */
    @Override
    public int updateSysUserEmail(SysUserEmail sysUserEmail)
    {
        sysUserEmail.setUpdateTime(DateUtils.getNowDate());
        return sysUserEmailMapper.updateSysUserEmail(sysUserEmail);
    }

    /**
     * 批量删除用户邮箱绑定
     * 
     * @param ids 需要删除的用户邮箱绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysUserEmailByIds(Long[] ids)
    {
        return sysUserEmailMapper.deleteSysUserEmailByIds(ids);
    }

    /**
     * 删除用户邮箱绑定信息
     * 
     * @param id 用户邮箱绑定主键
     * @return 结果
     */
    @Override
    public int deleteSysUserEmailById(Long id)
    {
        return sysUserEmailMapper.deleteSysUserEmailById(id);
    }

    /**
     * 修改用户邮箱的状态
     * @param id
     * @return
     */
    @Override
    public int updateStatus(String id)
    {
        return sysUserEmailMapper.updateStatusById(id);
    }

    /**
     * 获得用户的邮箱组
     * @param userId
     * @return
     */
    @Override
    public List<SysUserEmail> selectSysUserEmailList(Long userId) {
        return sysUserEmailMapper.selectEmailsList(userId);
    }
}
